<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<link href="/res/back/css/base.css" rel="stylesheet" type="text/css" />
<link href="/res/third/bootstrap3/css/bootstrap.min.css" rel="stylesheet" type="text/css" />
<script src="/res/common/js/jquery.1.9.1.min.js" type="text/javascript"></script>
<script src="/res/third/bootstrap3/bootstrap.autocomplete.js" type="text/javascript"></script>
<script src="/res/third/artDialog/jquery.artDialog.js" type="text/javascript"></script>
<script src="/res/third/validate/jquery.validate.js" type="text/javascript"></script>
<script src="/res/third/easyUI/jquery.easyui.min.js" type="text/javascript"></script>
<script src="/res/third/easyUI/locale/easyui-lang-zh_CN.js" type="text/javascript"></script>
<script type="text/javascript" src="/res/third/ueditor/ueditor.config.js"></script>
<script type="text/javascript" src="/res/third/ueditor/ueditor.all.js"></script>
<script type="text/javascript" src="/res/third/ueditor/lang/zh-cn/zh-cn.js"></script>
<script type="text/javascript">
	
</script>
<style type="text/css">
</style>

</head>

<body>
	<div id="editadvertise" style="padding-top:20px; height:100%; overflow-y:scroll">
			<form id="editform" method="post" action="/advertise/o_edit.do" class="form-horizontal" role="form">

			<div class="form-group">
				<label class="col-sm-2 control-label" id="clickforpro">广告位名称</label>
				<div class="col-sm-3">
					<input type="text" class="form-control" placeholder="" min="1" required="required" name="adName" id="editname" value="${advertise.adName!}">
				</div>
			</div>
			<div class="form-group">
				<label class="col-sm-2 control-label">广告位描述</label>
				<div class="col-sm-3">
					<input type="text" class="form-control" placeholder="" min="1" required="required" name="adDescr" value="${advertise.adDescr!}">
				</div>	
			</div>
			<div class="form-group">
				<label class="col-sm-2 control-label" id="clickforpro">广告位标识</label>
				<div class="col-sm-3">
					<input type="text" class="form-control" placeholder="" min="1" required="required" name="code" id="editcode" value="${advertise.code!}">
				</div>
			</div>
			<div class="form-group">
				<label class="col-sm-2 control-label">广告类型</label>
				<div class="col-sm-3">
					<select class="form-control" name="adType" id="edittype">
						[#list dictionarys as dictionary]
						<option value="${dictionary.code}" [#if advertise.adType?string==dictionary.code]selected[/#if]>${dictionary.name!}</option>
						[/#list]
					</select>
				</div>
			</div>
			<div class="form-group">
				<label class="col-sm-2 control-label" id="clickforpro">广告位尺寸</label>
				<div>
					宽：<input type="number" style="width:80px" placeholder="" min="1" required="required" name="width" id="editwidth" value="${advertise.width!}">px&nbsp;&nbsp;&nbsp;
					高：<input type="number" style="width:80px" placeholder="" min="1" required="required" name="height" id="editheight" value="${advertise.height!}">px
				</div>
			</div>
			
			

			<div class="form-group">
				<label class="col-sm-2 control-label">是否启用</label>
				<div class="col-sm-3">
					<input type="radio" id="editstatetrue"  placeholder="" min="1" required="required" name="state" value="1" checked="checked">是
					<input type="radio" id="editstatefalse" placeholder="" min="1" required="required" name="state" value="0">否
				</div>
			</div>

			<div class="form-group">
				<label class="col-sm-2 control-label">展示数量</label>
				<div class="col-sm-3">
					<input type="number" name="adNum" id="editNum" class="form-control" placeholder="" min="1" required="required" value="${advertise.adNum!}">
				</div>	
			</div>

			<div class="form-group">
				<label class="col-sm-2 control-label">广告模板</label>
				<div class="col-sm-3">
					<div class="form-ctrl">
						<textarea style="height:260px;width:500px"class="form-control" name="template"/>${advertise.template!}</textarea>
					</div>
				</div>
			</div>
			
			<input type="hidden" name="id" value="${advertise.id!}">
			<div class="form-group" style="margin-top: 10px;">
				<div class="col-sm-offset-2 col-sm-10">
					<input id="editsubmit" type="button" class="btn btn-default" value="提交" />
				</div>
			</div>
		</form>
	</div>
</body>
</html>
<script type="text/javascript">
	

	$('#editsubmit').click(function() {
		var name = $("input[id='editname']").val();
		if (!name) {
			alert('广告位名称必须填写!');
			return;
		}
		var code = $("input[id='editcode']").val();
		if (!code) {
			alert('广告位标识必须填写!');
			return;
		}
		var type = $("select[id='edittype']").val();
		if (!type) {
			alert('请选择广告类型!');
			return;
		}
		var width = $("input[id='editwidth']").val();
		var height = $("input[id='editheight']").val();
		if (!width||!height) {
			alert('请填写尺寸!');
			return;
		}
		$("#editform").submit();
	});
</script>
